// Package day_04_tree tree_serializer
// @Title day_04_tree
// @Description  二叉树的序列化和反序列化
// @Author  == 琳琳也叫王木木 ==  2021/8/31 15:03
// @Create  2021/8/31 15:03
package day_04_tree

import "fmt"

type Codec struct {
	Val   int
	Left  *Codec
	Right *Codec
}

func Constructor() Codec {
	return Codec{}
}

// Serializes a 3_tree to a single string. 序列化一个二叉树
func (this *Codec) serialize(root *TreeNode) string {
	// 节点和节点之间用下划线连接
	tempArr := make([]string, 0)
	var headRange = func(head *TreeNode) {}
	headRange = func(head *TreeNode) {
		if root == nil {
			tempArr = append(tempArr, "_#_#")
			return
		}
		tempArr = append(tempArr, string(rune(head.Val))+"_")
		headRange(root.Left)
		headRange(root.Right)
	}
	headRange(root)
	fmt.Println(tempArr)
	return ""
}

// Deserializes your encoded data to 3_tree. 反序列化一颗二叉树
func (this *Codec) deserialize(data string) *TreeNode {

	return nil
}

//Your Codec object will be instantiated and called as such:
